package com.itheima.mp.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author YUBOY
 * @date 2025/1/14
 * @Description 配置MybatisPlus的分页插件
 */
@Configuration
public class                 MybatisConfig {
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();// 创建MybatisPlusInterceptor对象
        //1.添加功能插件
        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
        paginationInnerInterceptor.setMaxLimit(1000L); //设置查询上限
        interceptor.addInnerInterceptor(paginationInnerInterceptor);
        // 添加分页插件
        return interceptor;
    }
}
